<div id="merchant_manage">
	<div class="merchant_manage">
		<el-row class="table_search">
			<el-col :span="18">
				<template>
		<!--			<el-input type="input" v-model="city" style="width: 150px;" placeholder="所属城市Id"></el-input>-->
<!--					<el-select v-model="cityId" filterable placeholder="请选择城市" style="width: 180px;">
						<el-option
								v-for="item in cityIds"
								:key="item.cityCode"
								:label="item.cityName"
								:value="item.cityCode">
						</el-option>
					</el-select>-->
<!--					<el-input type="input" v-model="orgId" style="width: 150px;" placeholder="所属机构Id"></el-input>-->
					<el-input type="text" style="width:160px;" v-model="orgName"  onclick="showMenu2();"  readonly clearable placeholder="所属机构"></el-input>
					<div id="menuContent2" class="menuContent2" style="display:none; position: absolute;z-index: 1000;overflow: auto;">
						<el-tree
								:data="orgTree"
								@node-click="treeClick2"
								:props="defaultProps"
								style="margin-top:0; width:200px;height:300px;"></el-tree>
					</div>
					<el-input type="input" v-model="corpCode" style="width: 150px;" placeholder="商户编号"></el-input>
					<el-input type="input" v-model="corpName" style="width: 150px;" placeholder="商户名称"></el-input>
					<el-select v-model="value" placeholder="全部状态" style="width:160px;" >
						<el-option
								v-for="item in options"
								:key="item.value"
								:label="item.label"
								:value="item.value">
						</el-option>
					</el-select>

					<el-button type="primary" @click="searchFun" icon="el-icon-search" style="margin-left: 20px">搜索</el-button>
				</template>
			</el-col>
			<el-col :span="3" class="text-r">
				<el-button type="primary" icon="el-icon-plus" @click="edit()">新增商户</el-button>
			</el-col>
			<el-col :span="3"  class="text-r">
				<el-button type="primary"  @click="exportMerchant"   icon="el-icon-plus">导出</el-button>
			</el-col>
		</el-row>

		<template>
			<el-table
					size="mini"
					:data="tableData"
					style="width: 100%" >
				<el-table-column
						align="center"
						prop="corpCode"
						label="商户编号"
						width="120">
				</el-table-column>
				<el-table-column
						align="center"
						prop="corpName"
						label="商户名称"
						width="260">
					<template slot-scope="scope">
						<span style="margin-left: 10px" @click="handleRowHandle(scope.row)">
							{{ scope.row.corpName }}
						</span>
					</template>
				</el-table-column>
				<el-table-column
						align="center"
						width="120"
						prop="orgName"
						label="所属机构">
				</el-table-column>
<!--				<el-table-column
						align="center"
						width="120"
						prop="cityName"
						label="所属城市">
				</el-table-column>-->
				<el-table-column
						align="center"
						width="120"
						prop="linkMan"
						label="联系人">
				</el-table-column>
				<el-table-column
						align="center"
						width="120"
						prop="linkPhone"
						label="联系人电话">
				</el-table-column>
				<el-table-column align="center" width="200" label="状态" prop="status" >
					<template slot-scope="scope">
						<el-switch
								v-model="scope.row.status"
								@change="disableMerchant(scope.$index, scope.row)"
								active-value="1"
								inactive-value="0"
								active-text="启用"
								inactive-text="停用"
								active-color="#13ce66"
								inactive-color="#ff4949">
						</el-switch>
					</template>
				</el-table-column>
				<el-table-column label="操作" align="center">
					<template slot-scope="scope">
						<el-button type="primary" icon="el-icon-edit-outline" size="mini" @click="edit(scope.$index, scope.row)">编辑</el-button>

				<!--		<el-button type="primary" size="mini" @click="disableMerchant(scope.$index, scope.row)" style="color: #fff">
							{{scope.row.status == '1'?'停用':'启用'}}
						</el-button>-->
					</template>
				</el-table-column>
			</el-table>

			<!--分页-->

			<div class="block footerBox" id="fenyeBox">
				<el-pagination
						background
						@current-change="handleCurrentChange"
						layout="total, prev, pager, next, jumper"
						:total="totalCount">
				</el-pagination>
			</div>
		</template>

	</div>

	<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" >

		<el-form
				class="add-template-form"
				:rules="rules"
				ref="form"
				:model="form"
				label-width="200px">
			<!-- 编辑隐藏 -->
			<el-form-item label="商户ID：" prop="corpId" :label-width="formLabelWidth" hidden="hidden">
				<el-input v-model="form.corpId" :disabled="true"></el-input>
			</el-form-item>
			<el-form-item label="商户编码：" prop="corpCode" :label-width="formLabelWidth" hidden="hidden">
				<el-input v-model="form.corpCode" :disabled="true"></el-input>
			</el-form-item>
			<!--多行文本框模板-->
			<el-form-item label="商户名称" prop="corpName" :label-width="formLabelWidth">
				<el-input type="" v-model="form.corpName"></el-input>
			</el-form-item>
			<el-form-item label="所属城市" prop="cityId" :label-width="formLabelWidth">
				<!--<el-input type="" v-model="form.cityId"></el-input>-->
				<el-select v-model="form.cityId" filterable :disabled="form.citySelect" placeholder="请选择" style="width: 202px;" @change="cityChange(e)">
					<el-option
							v-for="item in cityIds"
							:key="item.cityCode"
							:label="item.cityName"
							:value="item.cityCode">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="所属机构" prop="orgId" :label-width="formLabelWidth">
				<el-input type="" v-model="form.orgName"  onclick="showMenu();" :disabled="form.citySelect"  readonly ></el-input>
				<div id="menuContent" class="menuContent" style="display:none; position: absolute;z-index: 1000;overflow: auto;">
					<el-tree
							:data="orgTree"
							:props="defaultProps"
							@node-click="treeClick"
							style="margin-top:0; width:180px; height: 300px;"></el-tree>
				</div>
			</el-form-item>
			<el-form-item label="联系人" prop="linkMan" :label-width="formLabelWidth">
				<el-input type="" v-model="form.linkMan"></el-input>
			</el-form-item>
			<el-form-item label="联系人电话" prop="linkPhone" :label-width="formLabelWidth">
				<el-input type="" v-model="form.linkPhone"></el-input>
			</el-form-item>
			<el-form-item label="联系人邮箱" prop="linkEmail" :label-width="formLabelWidth">
				<el-input type="" v-model="form.linkEmail"></el-input>
			</el-form-item>
			<el-form-item label="对公账户" prop="cardNo" :label-width="formLabelWidth">
				<el-input type="" v-model="form.cardNo"></el-input>
			</el-form-item>
			<el-form-item label="是否推荐" prop="recommend" :label-width="formLabelWidth">
				<!--<el-input type="" v-model="form.recommend"></el-input>-->
				<el-switch v-model="form.recommend" active-value="1" inactive-value="0" active-text="推荐" inactive-text="不推荐"></el-switch>
			</el-form-item>
			<el-form-item label="商户状态" prop="status" :label-width="formLabelWidth">
				<!--<el-input type="" v-model="form.stauts"></el-input>-->
				<el-switch v-model="form.status" active-value="1" inactive-value="0" active-text="启用" inactive-text="停 用"></el-switch>
			</el-form-item>
			<el-form-item label="商户地址" prop="addr" :label-width="formLabelWidth">
				<el-input type="textarea" v-model="form.addr" style="width: 450px;"></el-input>
			</el-form-item>
			<el-form-item label="商户描述" prop="corpDesc" :label-width="formLabelWidth">
				<el-input type="textarea" v-model="form.corpDesc" style="width: 450px;"></el-input>
			</el-form-item>
			<el-form-item label="商户LOGO" prop="logoFile" :label-width="formLabelWidth">
				<el-input v-model="form.logoFile" :disabled="true" style="width:202px;"></el-input>
				<el-upload
						class="upload-demo"
						action="${basePath}bank/merchant/uploadPicFile"
						name="upload_file"
						accept=".jpg,.png"
						:on-preview="viewPic"
						:before-upload="beforeUpload"
						:on-success='upLogoScuccess'
						:on-remove="handleRemoveLogoFile"
						:file-list="form.realLogFile"
						:limit="1"
						list-type="picture-card" style="width:202px;">
					<!--<el-button size="small" type="primary">点击上传</el-button>
					<div slot="tip" class="el-upload__tip">只能上传图片，且不超过5M</div>-->
					<i class="el-icon-plus"></i>
				</el-upload>

			</el-form-item>
			<el-form-item label="商户合同" prop="contractFile" :label-width="formLabelWidth">
				<el-input v-model="form.contractFile" :disabled="true" style="width:202px;"></el-input>
				<el-upload
						class="upload-demo"
						action="${basePath}bank/merchant/uploadFile"
						name="upload_file"
						accept=".jpg,.png,.pdf"
						:before-upload="beforeUpload"
						:on-success='upScuccess'
						:on-remove="handleRemoveContractFile"
						:file-list="form.realContractFile"
						:limit="1">
					<el-button size="small" type="primary">点击上传</el-button>
					<div slot="tip" class="el-upload__tip">只能上传jpg/png/pdf文件，且不超过5M</div>
				</el-upload>
			</el-form-item>

		</el-form>

		<div slot="footer" class="dialog-footer">
			<el-button @click="dialogFormVisible = false">取 消</el-button>
			<el-button type="primary" @click="goConfirm">确 定</el-button>
		</div>
	</el-dialog>
	<el-dialog :visible.sync="picDialogVisible" size="tiny" >
		<img width="100%" :src="dialogImageUrl" alt="">
	</el-dialog>
	<el-dialog title="商户详情" :visible.sync="dialogInfoVisible" class="dialogDetails">
		<div class="info-template-content">
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">商户ID</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.corpId}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">商户编号</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.corpCode}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">商户姓名</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.corpName}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">所属城市</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.cityName}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">所属机构</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.orgName}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">地址</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.addr}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">联系人</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.linkMan}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">联系人电话</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.linkPhone}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">联系人邮箱</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.linkEmail}} </el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">对公账户</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.cardNo}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">推荐度</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.recommendName}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">状态</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.statusName}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">单位介绍</el-col>
				<el-col :span="18" style="color: #333">{{merchantInfo.corpDesc}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">创建人</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.creator}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">创建时间</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.createDate|formatDate}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">更新人</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.updator}}</el-col>
			</el-row>
			<el-row class="item-row">
				<el-col :span="4" style="color: #666">更新时间</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.updateDate|formatDate}}</el-col>
			</el-row>
			<el-row  class="item-row">
				<el-col :span="4" style="color: #666">更新IP</el-col>
				<el-col :span="15" style="color: #333">{{merchantInfo.updateIp}}</el-col>
			</el-row>
			<el-row  class="item-row">
				<el-col :span="4" style="color: #666">合同</el-col>
				<el-col :span="15" style="color: #333">
					<a :href="'${basePath}uploadFiles/file/'+ merchantInfo.contractFile"  target="_blank" >{{merchantInfo.contractFile!=''?'点击下载':''}}</a>
				</el-col>
			</el-row>
			<el-row  class="item-row" style="margin-bottom:0">
				<el-col :span="4" style="color: #666">LOGO</el-col>
				<el-col :span="15" style="color: #333">
					<img :src="'${basePath}uploadFiles/uploadImgs/'+ merchantInfo.logoFile"
						 height="100" width="150" >
				</el-col>
			</el-row>
		</div>

	</el-dialog>
</div>
<!--[if IE]>
<script>
	goIEPage(IEVersion(),'${basePath}/merchant_list_IE');
</script>
<![endif]-->

<!--[if !IE]><!-->
<script>
	Date.prototype.pattern=function(fmt) {
		var o = {
			"M+" : this.getMonth()+1, //月份
			"d+" : this.getDate(), //日
			"h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时
			"H+" : this.getHours(), //小时
			"m+" : this.getMinutes(), //分
			"s+" : this.getSeconds(), //秒
			"q+" : Math.floor((this.getMonth()+3)/3), //季度
			"S" : this.getMilliseconds() //毫秒
		};
		var week = {
			"0" : "/u65e5",
			"1" : "/u4e00",
			"2" : "/u4e8c",
			"3" : "/u4e09",
			"4" : "/u56db",
			"5" : "/u4e94",
			"6" : "/u516d"
		};
		if(/(y+)/.test(fmt)){
			fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
		}
		if(/(E+)/.test(fmt)){
			fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "/u661f/u671f" : "/u5468") : "")+week[this.getDay()+""]);
		}
		for(var k in o){
			if(new RegExp("("+ k +")").test(fmt)){
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
			}
		}
		return fmt;
	}

	var merchant_manage =
			new Vue({
				el: "#merchant_manage",

				data: {
					picDialogVisible:false,
					dialogImageUrl:'',
					cityIds:'',//城市select
					orgTree:'',//机构tree
					defaultProps: {
						label:'label',
						children: 'children',
						leaf:'leaf'
					},
					dialogTitle:'新增商户',
					dialogInfoVisible: false,//查看详情
					merchantInfo: {},//查看详情
					dialogFormVisible: false,
					form: {
						citySelect:false,
						corpId:'',
						corpCode:'',
						corpName:'',
						orgId:'',
						orgName:'',
						cityId:'',
						districtCode:'',
						addr:'',
						linkMan:'',
						linkPhone:'',
						linkEmail:'',
						status:'1',
						recommend:'',
						corpDesc:'',
						logoFile:'',
						realLogFile:[],
						contractFile:'',
						realContractFile:[]
					},
					rules: {
						corpName: [
							{ required: true, message: '请填写商户名称', trigger: 'blur' },
							{ min: 1, max: 100, message: '长度在 1 到 100 个字符', trigger: 'blur' }
						],
						cityId: [
							{ required: true, message: '请选择所属城市', trigger: 'blur' }
						],
						orgId: [
							{ required: true, message: '请选择所属机构', trigger: 'blur' }
						],
						linkPhone: [
							{ required: true, message: '请填写联系电话', trigger: 'blur' },
							{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' },
							{ pattern:/^1[345678]\d{9}$/, message:'电话号码格式不正确', trigger: 'blur' }
						],
						cardNo: [
							{ required: true, message: '请填写对公账户', trigger: 'blur' },
							{ min: 1, max: 40, message: '长度在 1 到 40 个字符', trigger: 'blur' }
						] ,
						addr: [
							{ required: true, message: '请填写商户地址', trigger: 'blur' },
							{ min: 1, max: 1000, message: '长度在 1 到 1000 个字符', trigger: 'blur' }
						],
						linkEmail: [
							{ min: 1, max: 100, message: '长度在 1 到 100 个字符', trigger: 'blur' },
							{type:'email',message:'请输入正确的邮箱',trigger:'blur,change'}
						],
						linkMan: [
							{ min: 1, max: 100, message: '长度在 1 到 100 个字符', trigger: 'blur' }
						]

					},
					formLabelWidth: '120px',
					corpCode:'',//查询用商户code
					corpName:'',//查询用商户name
					cityId:'',//查询用商户所属城市
					orgId:'',//查询用商户机构ID
					orgName:'',
					options: [//查询用商户状态
						{
							value: '',
							label: '全部状态'
						}
						,
						{
							value: '1',
							label: '启用'
						},
						{
							value: '0',
							label: '停用'
						}
					],
					parameters:{
						orgIds:''
					},
					value: '',
					tableData: [],
					tableData123: [],
					totalCount:'',
					totalPage:'',
					currentPage: 1,
					pageSize:10
				},
				filters: {
					formatDate:function(time) {
						var date = new Date(time);
						return date.pattern("yyyy-MM-dd hh:mm:ss");
					}
				},
				methods: {
					exportMerchant:function(){
						window.location.href = "${basePath}bank/exportToExcel";
					},
					treeClick2:function(o,node,tree){
						merchant_manage.orgId = o.id;
						merchant_manage.orgName = o.label;
						$("#menuContent2").fadeOut("fast");

					},
					treeClick:function(o,node,tree){
						merchant_manage.form.orgId = o.id;
						merchant_manage.form.orgName = o.label;
						$("#menuContent").fadeOut("fast");

					},
					beforeUpload:function(file){
						var isLt5M = file.size / 1024 / 1024 < 5;
						if (!isLt5M) {
							merchant_manage.$message.error('上传文件不能超过 5MB!');
						}
						return isLt5M;
					},
					/**
					 * 已完成
					 */
					upScuccess: function (response, file, fileList) {
						merchant_manage.form.contractFile = response;
					},
					upLogoScuccess: function (response, file, fileList) {
						merchant_manage.form.logoFile = response;
					},
					viewPic:function(file){
						merchant_manage.dialogImageUrl = file.url;
						merchant_manage.picDialogVisible = true;
					},
					handleRemoveContractFile: function (file, fileList) {
						var url = "${basePath}bank/merchant/removeFile";
						var option = {
							'fileName': merchant_manage.form.contractFile,
							'fileType': 'file'
						};
						sendService(url, option, function (resData) {
							if (resData.status == 'success') {
								merchant_manage.form.contractFile = "";
							}
						});
					},
					handleRemoveLogoFile: function (file, fileList) {
						var url = "${basePath}bank/merchant/removeFile";
						var option = {
							'fileName': merchant_manage.form.logoFile,
							'fileType': 'picture'
						};
						sendService(url, option, function (resData) {
							if (resData.status == 'success') {
								merchant_manage.form.logoFile = "";
							}
						});
					},
					/*
					*完成新增操作
					* */
					goConfirm: function () {
						this.$refs['form'].validate((valid) => {
							if (valid) {
								var url = "${basePath}bank/merchant/saveMerchant";
								var option = merchant_manage.form;
								sendService(url, option, function (resData) {
								    console.log(JSON.stringify(option));
									if (resData.status == 'success') {
										reloadPage('${basePath}bank/merchant');
										merchant_manage.$message({
											type: 'success',
											message: resData.msg
										});
									} else {
										merchant_manage.$message({
											type: 'failure',
											message: resData.msg
										});
									}
									merchant_manage.dialogFormVisible = false;
								});
							} else {
								merchant_manage.$message.error("表单验证失败，请检查");
								return false;
							}
						});
					},
					edit: function (index, row) {
						if (index != undefined) {
							if (event.stopPropagation){
								// this code is for Mozilla and Opera
								event.stopPropagation();
							}else if (window.event) {
								// this code is for IE
								window.event.cancelBubble = true;
							}
							merchant_manage.form.citySelect = true;
							merchant_manage.form.corpId = row.corpId;
							merchant_manage.form.corpCode = row.corpCode;
							merchant_manage.form.corpName = row.corpName;
							merchant_manage.form.cityId = row.cityId;
							merchant_manage.form.orgId = row.orgId;
							merchant_manage.form.orgName = row.orgName;
							merchant_manage.form.addr = row.addr;
							merchant_manage.form.linkMan = row.linkMan;
							merchant_manage.form.linkPhone = row.linkPhone;
							merchant_manage.form.linkEmail = row.linkEmail;
							merchant_manage.form.cardNo = row.cardNo;
							merchant_manage.form.corpDesc = row.corpDesc;
							merchant_manage.form.status = row.status;
							merchant_manage.form.recommend = row.recommend;
							merchant_manage.form.logoFile = row.logoFile;
							if(row.logoFile!=null && row.logoFile != ""){
								merchant_manage.form.realLogFile = [{
									name: row.logoFile,
									url: '${basePath}uploadFiles/uploadImgs/' +row.logoFile
//									url: '${basePath}bank/downloadPic?filePath=uploadFiles//uploadImgs//' + row.logoFile
								}];
							}else{
								merchant_manage.form.realLogFile = [];
							}
							merchant_manage.form.contractFile = row.contractFile;
							if(row.contractFile!=null && row.contractFile != ""){
								merchant_manage.form.realContractFile = [{
									name: row.contractFile,
									url: '${basePath}uploadFiles/file/' + row.contractFile
								}];
							}else{
								merchant_manage.form.realContractFile = [];
							}

							merchant_manage.dialogTitle = "编辑商户";
							merchant_manage.dialogFormVisible = true;
						}else{
							merchant_manage.form.citySelect = false;
							merchant_manage.form.corpId = '';
							merchant_manage.form.corpCode = '';
							merchant_manage.form.corpName = '';
							merchant_manage.form.cityId = '';
							merchant_manage.form.orgId = '';
							merchant_manage.form.orgName = '';
							merchant_manage.form.addr = '';
							merchant_manage.form.linkMan = '';
							merchant_manage.form.linkPhone = '';
							merchant_manage.form.linkEmail = '';
							merchant_manage.form.status = '1';
							merchant_manage.form.cardNo = '';
							merchant_manage.form.recommend = '';
							merchant_manage.form.corpDesc = '';
							merchant_manage.form.logoFile = '';
							merchant_manage.form.realLogFile = [];
							merchant_manage.form.contractFile = '';
							merchant_manage.form.realContractFile = [];

							merchant_manage.dialogTitle = "新增商户";
							merchant_manage.dialogFormVisible = true;
						}
					},
					/**
					 * 已完成
					 */
					handleCurrentChange: function(currentPage){

						merchant_manage.currentPage = currentPage;
						merchant_manage.searchFun();
					},
					/**
					 * 已完成
					 */
					searchFun: function () {
						if(merchant_manage.orgName == ''){
							merchant_manage.orgId = '';
						}
						var options = {
							'currentPage':merchant_manage.currentPage,
							'status':merchant_manage.value,
							'corpCode':merchant_manage.corpCode,
							'corpName':merchant_manage.corpName,
							'orgId':merchant_manage.orgId,
							'cityId':merchant_manage.cityId,
							orgIds:merchant_manage.parameters.orgIds
						};
						var url = '${basePath}bank/getMerchantList';
						sendService(url, options, function (resData) {
							if(resData.status == 'success'){
								merchant_manage.tableData = resData.t.merchantList;
								merchant_manage.totalPage = resData.page.totalPage;
								merchant_manage.totalCount = resData.page.totalResult;
							}
						})
					},
					/**
					 * 已完成
					 */
					disableMerchant: function (index, row) {//禁用/启用商户
						if (event.stopPropagation){
							// this code is for Mozilla and Opera
							event.stopPropagation();
						}else if (window.event) {
							// this code is for IE
							window.event.cancelBubble = true;
						}
						event.stopPropagation();
						window.event.cancelBubble = true;
						var params = {
								status:row.status,
								corpId:row.corpId
						};
						const loading = this.$loading({
							lock: true,
							text: 'Loading',
							spinner: 'el-icon-loading',
							background: 'rgba(0, 0, 0, 0.7)'
						});
						var url = '${basePath}bank/updateMerchant';
						sendService(url, params, function (resData) {
							loading.close();
							var successOrfail ;
							if(resData.status == 'success'){
								successOrfail = 'success';
							}else{
								successOrfail = 'failure';
							}
							merchant_manage.$message({
								type: successOrfail,
								message: resData.msg
							});
						});
						//reloadPage('${basePath}bank/merchant');
					},
					/**
					 * 已完成
					 */
					handleRowHandle: function (row) {
						merchant_manage.dialogInfoVisible = true;
						merchant_manage.merchantInfo = row;
					},
					/**
					 * 已完成
					 */
					goPage: function (url) {
						$(".main-right").empty();
						$(".main-right").load('${basePath}'+url);
					},
					filterMerchantStatusType: function (value, row) {

						row.status = (value == 1);
					},
					cityChange:function(value){
						alert(value);
					}
				},
				/**
				 * 已完成
				 */
				created: function () {

					sendService("${basePath}bank/org/getUserSelectOrgTree", null, function (resData) {
						if(null != resData.t) {
							merchant_manage.orgTree = resData.t;
							merchant_manage.parameters.orgIds = getChildrenId(resData.t);

							var url = '${basePath}bank/getMerchantList';
							var options = { currentPage:1,orgIds:merchant_manage.parameters.orgIds };
							sendService(url, options, function (resData) {
								if(resData.status == 'success'){
									merchant_manage.totalPage = resData.page.totalPage;
									merchant_manage.totalCount = resData.page.totalResult;
									merchant_manage.cityIds =  resData.t.cityList;
                                    merchant_manage.tableData = resData.t.merchantList;





								}
							});
						}
					});
				}
			});

	function showMenu() {
		if(merchant_manage.form.citySelect){
			return ;
		}

		$("#menuContent").slideDown("fast")
	}
	function showMenu2() {
		$("#menuContent2").slideDown("fast");
		$("body").bind("mousedown", onBodyDown2);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent2").length>0)) {
			hideMenu();
		}
	}
	function onBodyDown2(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent2" || $(event.target).parents("#menuContent2").length>0)) {
			hideMenu2();
		}
	}
	function hideMenu() {
		$("#menuContent2").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function hideMenu2() {
		$("#menuContent2").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown2);
	}
	function getChildrenId(children){
		var str = "";
		if (children != null){
			children.forEach(function (item) {
				str = str + item.id + ",";
				var child = item.children;
				if(child != null){
					str = str + getChildrenId(child) ;
				}
			});
		}
		return str;
	}

</script>
<!--<![endif]-->
<style scoped>
	.el-table__header,.el-table__body{
		width: 100% !important;
	}
	.el-table tr{
		height: 40px;
	}
	.addUsrtBtn{
		padding: 9px 15px;
		font-size: 12px;
	}
	/*table按钮样式调整开始*/
	.el-button--mini, .el-button--mini.is-round{
		padding: 4px 10px;
	}
	.userManageBox .editBtn{
		color: #409EFF;
		background-color: transparent;
		border-color: transparent;
	}
	.userManageBox .editBtn:hover{
		color: #fff;
		background-color: #409EFF;
		border-color: #409EFF;
	}

	.userManageBox .delBtn{
		color: #fa5555;
		background-color: transparent;
		border-color: transparent;
	}
	.userManageBox .delBtn:hover{
		color: #fff;
		background-color: #fa5555;
		border-color: #fa5555;
	}
	.userManageBox .resetBtn{
		color: #02dda7;
		background-color: transparent;
		border-color: transparent;
	}
	.userManageBox .resetBtn:hover{
		color: #fff;
		background-color: #02dda7;
		border-color: #02dda7;
	}
	.userManageBox .el-button{
		margin-left: 0;
	}
	/*table按钮样式调整结束*/
	.table_search, .table_btn{
		height: 60px;
		margin-bottom: 10px;
		background: #fff;
		padding: 10px 20px 30px;
	}
	/*.el-table td, .el-table th.is-leaf{*/
	/*border: none;*/
	/*}*/
	.el-table::before{
		height: 0;
	}
	.addUserBox{
		margin-bottom: 0;
		border-bottom: 1px solid #f2f4f8;
	}
	.el-input{
		width: auto;
	}
	.text-r{
		text-align: left;
	}
	.footerBox {
		width: 100%;
		height: 50px;
		background-color: #fff;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
		padding-top: 9px;
		text-align: right;
	}

	.add-template-form > div{
		margin-left: 45px;
	}
	.el-dialog__header{
		z-index: 999;
	}
	.el-dialog__header span{
		padding-left: 20px;
	}
	.el-dialog__wrapper .el-dialog__body{
		margin-top: 40px;
		height: 400px;
		overflow: auto;
	}
/*	#menuContent{
		left: 0 !important;
		top: 40px !important;
		background-color: #eee;
		border: 1px solid #ccc;
	}*/
	#menuContent{
		/*left: 0 !important;*/
		/*top: 40px !important;*/
		background-color: #fff;
		border: 1px solid #ccc;
	}
	#menuContent2{
		/*left: 0 !important;*/
		/*top: 40px !important;*/
		background-color: #fff;
		border: 1px solid #ccc;
	}
	.edit-template-form > div{
		margin-left: 45px;
	}
	/*.edit_dialog .el-form-item.is-required .el-form-item__label:before{*/
	/*content: '';*/
	/*}*/
	#addMenuContent{
		left: 0 !important;
		top: 40px !important;
		background-color: #eee;
		border: 1px solid #ccc;
	}


	.dialogDetails .topNav{
		margin-left: 30px;
		margin-bottom: 20px;
	}
	.dialogDetails .title-template{
		height: 60px;
		line-height: 60px;
		font-size: 18px;
		padding-left: 30px;
		margin-bottom: 10px;
		color: #333333;
		background: #ffffff;
	}

	.dialogDetails .info-template-content{
		background: #ffffff;
	}
	.dialogDetails .item-row{
		height: 46px;
		line-height: 46px;
		font-size: 16px;
		padding-left: 100px;
	}
	.dialogDetails .item-row div:first-of-type{
		color: #aaa;
		text-align: left
	}
	.dialogDetails .item-row div:last-of-type{
		color: #333;
		padding-left: 80px
	}

	.dialogDetails .info-template-content .el-row:nth-child(even){
		background-color: #F8F9FB;
	}
	.dialogDetails .info-template-content .el-row:last-of-type{
		margin-bottom: 30px;
	}
	.dialogDetails .el-dialog{
		overflow: hidden;
		-webkit-box-shadow: 0 0 16px rgba(0,0,0,0.5);
		-moz-box-shadow: 0 0 16px rgba(0,0,0,0.5);
		box-shadow: 0 0 16px rgba(0,0,0,0.5);
	}


	.el-dialog__header{
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		border-bottom: 1px solid rgba(255,68,68,1);
		width: 100%;
		position: absolute;
		left: 0px;
		top: 0px;
		background-color: #fff;
	}
	.el-dialog__headerbtn .el-dialog__close{
		color: #aaa;
		font-size: 22px;

	}
	.el-dialog__body{
		padding-top: 75px;
	}
	.dialogDetails .el-dialog__body{
		padding: 50px 0 0 0 ;
	}
	.errorBox{
		color: #fa5555;
		font-size: 12px;
		line-height: 1;
		padding-top: 4px;
		position: absolute;
		top: 100%;
		left: 0;
	}
	.errorBox2333{
		color: #fa5555;
		font-size: 12px;
	}
	/*#selManage label{*/
	/*position: relative;*/
	/*}*/
	#selManage label:before{
		content: '*';
		color: #fa5555;
		margin-right: 4px;

	}


	/*详情页样式*/
	.footerBox{
		padding-right: 50px;
	}
</style>